<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />

<meta name="viewport"
	content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>客户页面</title>
<link rel="stylesheet" href="layui/css/layui.css">
<!--地址为在线引用地址，请替换自己项目中layui路径-->
<script src="layui/layui.js"></script>
<!--地址为在线引用地址，请替换自己项目中layui路径-->
<script src="js/jquery-3.4.0.min.js"></script>
<script src="js/selectOrders.js"></script>

<style>
.layui-tab-title li {
	display: block;
}

.layui-tab-title {
	float: left;
	width: 200px;
}

.layui-tab-content {
	float: left;
	width: 1000px;
}
</style>
</head>
<body>

	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 50px;">
		<legend>管理员页面</legend>
	</fieldset>
	<div id="navbar" class="navbar-collapse collapse in" aria-expanded="true" style="position:absolute;top:75px;right:75px">
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="#">&nbsp;<span class="glyphicon glyphicon-user" aria-hidden="true"></span>&nbsp;&nbsp;管理员&nbsp;&nbsp;:<span th:text = "${session.userId}"></a>
                	<a href="/Logout" style="margin-left:10px;font-size:20px;">退出</a>
                </li>
              

              
            </ul>
        </div>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
			<li class="layui-this">首页</li>
			<li >查看所有订单</li>
			<li >新增用户</li>
		

		</ul>
		<div class="layui-tab-content" style="height: 100px;">
			<!-- 首页 -->
	    	<div class="layui-tab-item layui-show">欢迎来到管理员首页</div>
			<!--所有订单-->
			<div class="layui-tab-item">
				<table class="layui-hide" id="selectOrders" lay-filter="selectOrders"></table>	
			</div>
	
			<!--添加用户-->
			<div class="layui-tab-item">
				 <form class="layui-form layui-form-pane" lay-filter="form1" action="" id="form1">
					  <br>
					  <div class="layui-form-item">
					   <label class="layui-form-label">账号ID：</label>
					   <div class="layui-input-block">
					     <input type="text" name="userId"  id="userId" lay-verify="title" autocomplete="off"  placeholder="不能为空(数字)" class="layui-input">
					   </div>
					 </div>
					   <div class="layui-form-item">
					   <label class="layui-form-label">账号名字：</label>
					   <div class="layui-input-block">
					     <input type="text" name="userName"  id="userName" lay-verify="title" autocomplete="off"  placeholder="不能为空" class="layui-input">
					   </div>
					 </div>
					  <div class="layui-form-item">
					    <label class="layui-form-label">密码</label>
					    <div class="layui-input-block">
					      <input type="password" name="password" id="password" lay-verify="title" autocomplete="off" placeholder="不能为空" class="layui-input">
					    </div>
			  </div>
					  <div class="layui-form-item">
					<label class="layui-form-label">用户类型：</label>
					<select name="type" class="text" id="select1">
						<option class="text" value="2">----请选择身份----</option>
						<option value="7" >系统管理员</option>
						<option value="2" >销售员</option>
						<option value="3" >销售经理</option>
						<option value="4" >包装员</option>
						<option value="5" >包装经理</option>
						<option value="6" >集装箱员</option>
						<option value="1" >客户</option>
					</select>
				</div>
					<div ><button type="button" lay-submit lay-filter="btn12"  class="layui-btn" style="margin-left: 160px;" id="btn12">提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button></div>
					</form>
			</div>
			
		</div>
	</div>

	<!-- <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>
		layui.use('element', function() {
			var $ = layui.jquery, element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		})
	</script>
<script>
$("#btn12").click("on",function(){
	var userId=$("#userId").val();
	var userName=$("#userName").val();
	var password=$("#password").val(); 
	var type=$("#select1").val();
	console.log(userId);
	console.log(userName);
	console.log(password);
	console.log(type);
	$.ajax({
		url:"/insertUser",
		dataType: 'json',
     type: 'post',
     data:{userId:userId,
    	 userName:userName,
    	 password:password,
    	 type:type},
     success: function () {
    	
     	layer.msg("新增成功");
     },
     error: function () {
        layer.msg("新增失败");
     }
 })

})


</script>




</body>
</html>
